package com.cdj.common.activity;

import android.os.Bundle;

import com.cdj.common.ILoadingBehavior;
import com.cdj.common.behavior.DefualtLoadingBehavior;


/**
 * ---------------------------------------------------------<br />
 * desc：具有加载数据功能的展示页<br />
 * author：chendeji <br />
 * date：2021/6/3<br />
 * email：18701434169@163.com<br />
 * qq: 781571323
 * wx: melody_2009
 * ---------------------------------------------------------<br />
 */
public abstract class BaseLoadDataActivity extends BaseActivity{
    protected ILoadingBehavior defualLoadingBehavior;

    @Override
    protected void initView(Bundle savedInstanceState) {
        setDefualLoadingBehavior(new DefualtLoadingBehavior(this));
    }

    public void setDefualLoadingBehavior(ILoadingBehavior defualLoadingBehavior) {
        this.defualLoadingBehavior = defualLoadingBehavior;
    }

    protected ILoadingBehavior getLoadingBehavior() {
        return defualLoadingBehavior;
    }

    /**
     * desc：显示加载提示内容<br />
     * author：陈德基<br />
     * date：2021/6/3<br />
     * qq: 781571323
     * wx: melody_2009
     */
    protected void showLoading() {
        if (defualLoadingBehavior != null) {
            defualLoadingBehavior.onLoading();
        }
    }

    /**
     * desc：结束加载<br />
     * author：陈德基<br />
     * date：2021/6/3<br />
     * qq: 781571323
     * wx: melody_2009
     */
    protected void finishLoading() {
        if (defualLoadingBehavior != null) {
            defualLoadingBehavior.finishLoad();
        }
    }
}
